﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Web;
using System.Web.Mvc;
using System.Web.Security;

namespace OITPMS_MVC4.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application.";

            return View();
        }

        public ActionResult About()
        {
            ViewBag.Message = "Your app description page.";

            return View();
        }

        public ActionResult Contact()
        {
            ViewBag.Message = "Your contact page.";

            return View();
        }
        //public ActionResult Login()
        //{
        //    return View();
        //}

        //[HttpPost]
        //public ActionResult Login(Models.LoginModel login)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        if (IsValid(login.UserName, login.Password))
        //        {
        //           FormsAuthentication.SetAuthCookie(login.UserName,false);
        //            return RedirectToAction("Index");
        //        }
        //    }
        //    return View();
        //}
        //public ActionResult ForgotPassword()
        //{
        //    throw new NotImplementedException();
        //}

        //private bool IsValid(string email, string password)
        //{
        //    var crypto = new SimpleCrypto.PBKDF2();
        //    bool isValid = false;

        //    using (var db = new MainDbContext())
        //    {
        //        var user = db.SystemsUsers.FirstOrDefault(u => u.Email == email);
        //        if (user != null)
        //        {
        //            var a = new System.Guid();
                    
        //            //if (user.Password == crypto.Compute(password, user.PasswordSalt))
        //            {
        //                isValid = true;
        //            }
        //        }
        //    }

        //    return isValid;
        //}
    }
}
